﻿using Inovout.Descriptors;
using System;

namespace Inovout.Security
{
    public partial class EnumOperation
    {
        public virtual Enum OperationEnum
        {
            get
            {
                EnumDescriptor enumDescriptor = EnumDescriptor.Get(OperationEnumType);
                return enumDescriptor[OperationEnumValue].Value;

            }
            set
            {
                OperationEnumType = value.GetType();
                OperationEnumValue = int.Parse(value.ToString("D"));
                base.Name = OperationEnumType.FullName + "," + value.ToString();
            }
        }
        public override string ToString()
        {
            if (this.OperationEnum.Equals(ObjectOperation.Execute))
            {
                return string.Empty;
            }
            return base.ToString();
        }
    }
}
